package com.example.business_oa.controller;


import com.example.business_oa.service.FuLiShenQingService;
import com.example.business_oa.service.FuLiZhuBiaoService;
import com.example.business_oa.service.QiDongFuLiLiuCheng;
import com.example.business_oa.service.SelectLeaderService;
import com.example.comment_oa.dubbo.FuLiZhuBiaoDubbo;
import com.example.comment_oa.pojos.FlApplyzhu;
import com.example.comment_oa.pojos.SysEmployee;
import com.example.comment_oa.pojos.SysPost;
import com.example.comment_oa.response.AjaxResponse;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin
@RequestMapping("/businessOa")
public class FuLIQiDongLiuChengController {
    @Resource
    QiDongFuLiLiuCheng qiDongFuLiLiuCheng;

    @Resource
    FuLiZhuBiaoService fuLiZhuBiaoService;

    @Resource
    SelectLeaderService selectLeaderService;


//    @GetMapping("/qidongliucheng")
//    public AjaxResponse selectZhiWeiXiala(@PathVariable("Gonghao") String Gonghao){
//
//
//        HashMap<String, Object> variables = new HashMap<>();
//        SysEmployee sysEmployee = selectLeaderService.selectGongHao(Gonghao);
//        variables.put("assignee1",sysEmployee.getEmpCard());
//
////        qiDongFuLiLiuCheng.qidongliucehng(Gonghao,variables);
//        return  AjaxResponse.success();
//    }

    @PostMapping("/xiugaiZiDuan2/{Gonghao}")
    public AjaxResponse xiugaiziDuan2(@RequestBody FlApplyzhu flApplyzhu,@PathVariable("Gonghao") String Gonghao){
        //这个是修改那个主表的字段的
        fuLiZhuBiaoService.updateziduan2(flApplyzhu);
        //这个是关于流程的
        HashMap<String, Object> variables = new HashMap<>();
        SysEmployee sysEmployee = selectLeaderService.selectGongHao(Gonghao);
//        variables.put("assignee1",sysEmployee.getEmpCard());
//        variables.put("FuLiBianHao",flApplyzhu.getFlBianhao());
        String assignee1 = sysEmployee.getEmpCard();
        String fulibianhao = flApplyzhu.getFlBianhao();

        qiDongFuLiLiuCheng.qidongliucehng(Gonghao,variables,assignee1,fulibianhao);
       // System.err.println(Gonghao+","+variables+","+assignee1+","+fulibianhao);
        return AjaxResponse.success();
    }


}
